package cn.tedu.exception;

import java.io.InputStreamReader;

public class TryCatchDemo {
    public static void main(String[] args) {
        try {
            System.out.println("程序开始了");
            String line = "a";
            System.out.println(line.length());
            System.out.println(line.charAt(0));
            System.out.println(Integer.parseInt(line));
        } catch (NullPointerException | StringIndexOutOfBoundsException e) {
            System.out.println("出现了空指针异常");
            System.out.println("字符串下标越界异常");
        }catch (Exception e){
            System.out.println("通用错误解决办法");
        }

    }
}
